package optimizers.ganeat.square;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.Executors;

import javax.swing.JPanel;
import javax.swing.JProgressBar;

import org.w3c.dom.Element;

import common.RunStatus;

import fitness.Fitness;
import fitness.SquareFitness;

import optimizers.commons.RunConfig;
import optimizers.commons.evaluator.FitnessEvaluationService;
import optimizers.ganeat.Connection;
import optimizers.ganeat.Constants;
import optimizers.ganeat.GA;
import optimizers.ganeat.Individual;
import optimizers.ganeat.Node;
import optimizers.ganeat.Species;
import optimizers.ganeat.bistableswitch.IndividualBistableSwitch;
import optimizers.ganeat.report.LoggerNEAT;
import optimizers.ganeat.sin.GASin;
import optimizers.ganeat.sin.IndividualSin;
import runconfiguration.SinConfiguration;
import runconfiguration.SquareConfiguration;
import visualization.GraphDisplayer;

public class GASquare extends GA {
	String initIndiv = "Node gens:\r\n" + " a 73.921 9.6335\r\n"
			+ " c 74.1655 1\r\n" + " Icc 0.7417 1\r\n" + " i 116.806 1\r\n"
			+ " r 37.1629 1\r\n" + "Connection gens:\r\n"
			+ " 1 a->a false 4.9\r\n" + " 7 a->c false 0.6804\r\n"
			+ " 8 c->a false 9.3231\r\n" + " 16 c->c true 15.9186\r\n"
			+ " 17 a->Icc true 37.208\r\n" + " 43 c->i false 0.3631\r\n"
			+ " 44 i->a true 60\r\n" + " 87 c->r true 4.2666\r\n"
			+ " 88 r->i true 10.1278\r\n" + "Exo: 0\r\n" + "Pol: 0\r\n"
			+ "Nick: 0";

	public GASquare(RunConfig config, JPanel panelFitness, JPanel panelSpecies,
			JPanel panelIndiv, RunStatus runStatus, JProgressBar progressBar,
			Element fitnessElement) {
		super(config, panelFitness, panelSpecies, panelIndiv, runStatus,
				progressBar, fitnessElement);
	}

	public GASquare(RunConfig config, String initIndiv, JPanel panelFitness,
			JPanel panelSpecies, JPanel panelIndiv, RunStatus runStatus,
			JProgressBar progressBar, Element fitnessElement) {
		super(config, panelFitness, panelSpecies, panelIndiv, runStatus,
				progressBar, fitnessElement);
		this.initIndiv = initIndiv;
	}

	@Override
	public Individual getInitialIndividual() {
		return new IndividualSquare(innovations, nodeNames, -1, 0, config,
				initIndiv);
	}

	@Override
	public Individual getNewIndividual(Map<String, Integer> innovations2,
			Map<String, String> nodeNames2, int i, int j) {
		return new IndividualSquare(innovations2, nodeNames2, i, j, config);
	}

	@Override
	public String getProblemName() {
		// TODO Auto-generated method stub
		return "Square";
	}

}
